package com.xb.algorithm.web;

import com.xb.algorithm.utils.sm4.SM4Utils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author xb
 * @descripton:
 * @date 2021/11/27
 */
@RestController
@RequestMapping("/test")
public class TestController {
    @GetMapping("/getStr")
    public String test(String str) {
        System.out.println("前端传入的字符串：" + str);
        String secretKey = "11HDESaAhiHHugDz";
        System.out.println("后端解密前端的密文：" + SM4Utils.decryptData_ECB(str, secretKey));
        String text = "后端传入前端的SM4加密字符串";
        return SM4Utils.encryptData_ECB(text, secretKey);
    }
}
